package com.company.cloud.tenant.client;

import com.company.cloud.common.bean.BaseClientResult;
import com.company.cloud.tenant.modules.api.service.TenantCheckRemoteService;
import com.company.cloud.tenant.modules.app.service.TenantAppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Service
public class TenantCheckRemoteServiceImpl implements TenantCheckRemoteService {

    @Autowired
    private TenantAppService tenantAppService;

    @Override
    public BaseClientResult<String> checkTenantAuth(String tenantCode) {
        try {
            tenantAppService.checkTenantPermission(tenantCode);
            return BaseClientResult.success();
        }catch (Exception e){
            e.printStackTrace();
            return BaseClientResult.error(e);
        }
    }
}
